import java.util.Scanner;

public class Ex3_20{
	public static void main(String[] args){
		Scanner input = new Scanner(System.in);
		System.out.print("Enter the temputer in Fahrenheit: ");
		double t = input.nextDouble();
		System.out.print("Enter the wind speed miles per hour: ");
		double v = input.nextDouble();
		boolean temputerOk = true;
		boolean speedOk = true;
		if (t < -58 || t > 41)
			temputerOk = false;
		if (v < 2)
			speedOk = true;
		if (temputerOk && speedOk){
			double twc = 35.74 + 0.6215*t - 35.75*Math.pow(v, 0.16) + 
			0.4275*t*Math.pow(v, 0.16);
			System.out.printf("The wind chill index is %f\n", twc);
		}
		else if (!temputerOk && speedOk)
			System.out.printf("Error: Only the temputer is invalid.\n");
		else if (temputerOk && !speedOk)
			System.out.printf("Error: Only the wind speed is invalid.\n");
		else
			System.out.printf("Error: Both the temputer and the wind speed are invalid.\n");
	}
}